﻿using System;
using System.Configuration;

namespace Synergy.SharePoint.Configuration
{
	/// <summary>
	/// Represents a configuration section metadata definition.
	/// </summary>
	public sealed class ConfigurationSection : ConfigurationSectionBase
	{
		#region | Initialization |

		/// <summary>
		/// Initializes a new instance of the <see cref="ConfigurationSection"/> class.
		/// </summary>
		/// <param name="name">The name.</param>
		/// <param name="type">The type.</param>
		public ConfigurationSection(string name, Type type) : base(name, type) { }


		/// <summary>
		/// Initializes a new instance of the <see cref="ConfigurationSection"/> class.
		/// </summary>
		/// <param name="name">The name.</param>
		/// <param name="type">The type.</param>
		public ConfigurationSection(string name, string type) : base(name, type) { }


		/// <summary>
		/// Initializes a new instance of the <see cref="ConfigurationSection"/> class.
		/// </summary>
		/// <param name="name">The name.</param>
		/// <param name="type">The type.</param>
		/// <param name="allowDefinition">The allow definition.</param>
		public ConfigurationSection(string name, Type type, ConfigurationAllowDefinition allowDefinition) : base(name, type)
		{
			AllowDefinition = allowDefinition;
		}


		/// <summary>
		/// Initializes a new instance of the <see cref="ConfigurationSection"/> class.
		/// </summary>
		/// <param name="name">The name.</param>
		/// <param name="type">The type.</param>
		/// <param name="allowDefinition">The allow definition.</param>
		public ConfigurationSection(string name, string type, ConfigurationAllowDefinition allowDefinition) : base(name, type)
		{
			AllowDefinition = allowDefinition;
		}

		#endregion


		#region | Properties |

		/// <summary>
		/// Gets a value indicating whether the associated configuration section requires access permissions.
		/// </summary>
		/// <value><c>true</c> if the <c>requirePermission</c> attribute is set to <c>true</c>; otherwise, <c>false</c>.</value>
		public bool RequirePermission { get; set; }


		/// <summary>
		/// Gets or sets a value indicating where in the configuration file hierarchy the associated configuration section can be defined.
		/// </summary>
		/// <value>A <see cref="ConfigurationAllowDefinition"/> value indicating where in the configuration file hierarchy the associated <see cref="System.Configuration.ConfigurationSection"/> object may be declared.</value>
		public ConfigurationAllowDefinition AllowDefinition { get; set; }

		#endregion
	}
}